<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/view/include/taglib.jsp"%>
<html>
<head>
   	<title>${fns:getConfig('productName')}</title>
    <meta name="decorator" content="blank"/>
	<%@include file="/WEB-INF/view/include/comfile.jsp" %>
    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->
    <link href="${ctxStatic}/css/plugins/iCheck/custom.css" rel="stylesheet">
    <script src="${ctxStatic}/js/plugins/iCheck/icheck.min.js"></script>
    <link href="https://cdn.bootcss.com/bootstrap-select/2.0.0-beta1/css/bootstrap-select.min.css"  rel="stylesheet">
    <script src="https://cdn.bootcss.com/bootstrap-select/2.0.0-beta1/js/bootstrap-select.min.js"></script>
</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins page-ibox">
                    <div class="ibox-title">
                    	<h3>导航信息</h3>
                    </div>
                    
	                <div class="ibox-content">
	                <form:form id="menuForm" modelAttribute="menu" action="${ctx}/sys/menu/save" method="post" class="form-horizontal">
	                	<form:hidden path="id"/>
                        <div class="form-group m-b-bg">
                            <label class="col-sm-2 control-label">名称</label>
                            <div class="col-sm-6">
                                 <input name="name" type="text" class="form-control" value="${menu.name}" >
                            </div>
                        </div>
                        <div class="form-group m-b-bg">
                            <label class="col-sm-2 control-label">链接</label>
                            <div class="col-sm-6">
                                 <input name="href" type="text" class="form-control" value="${menu.href}" >
                            </div>
                        </div>
                        <div class="form-group m-b-bg">
                            <label class="col-sm-2 control-label">目标</label>
                            <div class="col-sm-6">
                                <input name="target" type="text" class="form-control"  value="${menu.target}">
                            </div>
                        </div>
                        <div class="form-group m-b-bg">
							<label class="col-sm-2 control-label">父级</label>
							<div class="col-sm-6">
								<select class="form-control selectSearch" name="pid" multiple data-live-search="true" >
                                   <c:forEach items="${fns:findMenus()}" var="menu" varStatus="idxStatus">
	                                    <option value="${menu.id}" <c:if test="${menu.id.equals(pid)}">selected</c:if>>${menu.name}</option>
		                        	</c:forEach>
                                </select>
							</div>
						</div>
                        <div class="form-group m-b-bg">
                            <label class="col-sm-2 control-label">图标</label>
                            <div class="col-sm-6">
                                <input name="icon" type="text" class="form-control" value="${menu.icon}">
                            </div>
                        </div>
                        <div class="form-group m-b-bg">
                            <label class="col-sm-2 control-label">排序</label>
                            <div class="col-sm-6">
                                 <input name="sort" type="number" class="form-control" value="${menu.sort}" >
                            </div>
                        </div>
                        <div class="form-group m-b-bg">
                            <label class="col-sm-2 control-label">主页显示</label>
                            <div class="col-sm-6">
                                <label class="checkbox-inline i-checks">
									<input type="radio" <c:if test="${menu.isShow}">checked</c:if> name="isShow" value="1">显示
								</label>
								<label class="checkbox-inline i-checks">
									<input type="radio" <c:if test="${!menu.isShow}">checked</c:if> name="isShow" value="0">不显示
								</label>
                            </div>
                        </div>
                        
                        <div class="form-group m-b-bg">
                            <label class="col-sm-2 control-label">备注</label>
                            <div class="col-sm-6">
                                 <textarea  name="remarks" class="form-control" style="height: 120px;">${menu.remarks}</textarea>
                            </div>
                        </div>
                        
                         <div class="form-group">
                             <div class="col-sm-4 col-sm-offset-4">
                                 <button class="btn btn-primary" type="submit">保 存</button>
                                 <button class="btn btn-white" type="button" onclick="history.go(-1)">返 回</button>
                             </div>
                         </div>
	                </form:form> 
	                </div>
	                	
                </div>
            </div>
        </div>
    </div>
    
    
    <script>
        $(document).ready(function(){
        	
        	 $('.selectSearch').selectpicker({  
        		 liveSearch: true,
        		 noneSelectedText:"请选择父级菜单",
        	     maxOptions: 1  
             });  
        	 $(".i-checks").iCheck({
         		checkboxClass:"icheckbox_square-green",
         		radioClass:"iradio_square-green"
         	});	
		});
    </script>
</body>
</html>
